package org.example.springoauth2.resourceserver2.controller;

import org.example.springoauth2.securitycommon.common.ApiResp;
import org.example.springoauth2.securitycommon.config.Inner;
import org.example.springoauth2.securitycommon.entity.JdbcUser;
import org.example.springoauth2.securitycommon.util.SecurityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hzq
 * @date 2021/10/12 10:16
 */
@RestController
@RequestMapping("/home")
public class HomeController {

    @Inner
    @GetMapping("/info")
    public ApiResp<String> info() {
        return ApiResp.ofSuccess("resource-server1 home info");
    }

    @Inner
    @GetMapping("/user")
    public ApiResp<JdbcUser> user() {
        return ApiResp.ofSuccess(SecurityUtils.getSysUser().getJdbcUser());
    }
}
